<template>
  <div id="home">
    <home-header></home-header>
    <home-swiper :swiperList="swiperList"></home-swiper>
    <home-icons :iconList="iconList"></home-icons>
    <home-recommend :recommendList="recommendList"></home-recommend>
    <home-weekend :weekendList="weekendList"></home-weekend>
  </div>
</template>

<script>
import HomeHeader from './components/homeheader'
import HomeSwiper from './components/homeswiper'
import HomeIcons from './components/homeicons'
import HomeRecommend from './components/homerecommend'
import HomeWeekend from './components/homeweekend'
export default {
  name: 'Home',
  components: {
    HomeHeader,
    HomeSwiper,
    HomeIcons,
    HomeRecommend,
    HomeWeekend
  },
  data() {
    return {
      iconList: [],
      recommendList: [],
      swiperList: [],
      weekendList: []
    }
  },
  methods: {
    getHome() {
      var api = 'api/home'
      this.rq.get(api).then((resp) => {
        var data = resp.data.homeData
        if (data.ret && data.data) {
          data = data.data
          this.iconList = data.iconList
          this.recommendList = data.recommendList
          this.swiperList = data.swiperList
          this.weekendList = data.weekendList
        }
      })
    }
  },
  mounted() {
    this.getHome()
  }
}
</script>
